home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / CoreFoundation / CFURLAccess.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  6.5 KB  |  201 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        CFURLAccess.h
  3.  
  4.      Contains:    CoreFoundation url access
  5.  
  6.      Version:    Technology:    Mac OS X
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __COREFOUNDATION_CFURLACCESS__
  18. #define __COREFOUNDATION_CFURLACCESS__
  19.  
  20. #ifndef __COREFOUNDATION_CFURL__
  21.     #include <CoreFoundation\CFURL.h>
  22. #endif
  23.  
  24. #ifndef __COREFOUNDATION_CFARRAY__
  25.     #include <CoreFoundation\CFArray.h>
  26. #endif
  27.  
  28. #ifndef __COREFOUNDATION_CFDATA__
  29.     #include <CoreFoundation\CFData.h>
  30. #endif
  31.  
  32. #ifndef __COREFOUNDATION_CFDICTIONARY__
  33.     #include <CoreFoundation\CFDictionary.h>
  34. #endif
  35.  
  36. #ifndef __COREFOUNDATION_CFSTRING__
  37.     #include <CoreFoundation\CFString.h>
  38. #endif
  39.  
  40.  
  41. /* Fills buffer with the file system's native representation of url's */
  42. /* path. No more than bufLen bytes are written to buffer.  If resolveAgainstBase */
  43. /* is true, the url's relative portion is resolved against its base before */
  44. /* the path is computed.  usedBufLen is set to the number of bytes actually */
  45. /* written; returns success or failure. */
  46.  
  47.  
  48. #if PRAGMA_ONCE
  49. #pragma once
  50. #endif
  51.  
  52. #ifdef __cplusplus
  53. extern "C" {
  54. #endif
  55.  
  56. #if PRAGMA_IMPORT
  57. #pragma import on
  58. #endif
  59.  
  60. #if PRAGMA_STRUCT_ALIGN
  61.     #pragma options align=mac68k
  62. #elif PRAGMA_STRUCT_PACKPUSH
  63.     #pragma pack(push, 2)
  64. #elif PRAGMA_STRUCT_PACK
  65.     #pragma pack(2)
  66. #endif
  67.  
  68. #if PRAGMA_ENUM_ALWAYSINT
  69.     #pragma enumsalwaysint on
  70. #elif PRAGMA_ENUM_OPTIONS
  71.     #pragma option enum=int
  72. #elif PRAGMA_ENUM_PACK
  73.     #if __option(pack_enums)
  74.         #define PRAGMA_ENUM_PACK__COREFOUNDATION_CFURLACCESS__
  75.     #endif
  76.     #pragma options(!pack_enums)
  77. #endif
  78.  
  79. EXTERN_API_C( Boolean )
  80. CFURLGetFileSystemRepresentation (CFURLRef                 url,
  81.                                  Boolean                 resolveAgainstBase,
  82.                                  char *                    buffer,
  83.                                  CFIndex                 bufLen);
  84.  
  85. EXTERN_API_C( CFURLRef )
  86. CFURLCreateFromFileSystemRepresentation (CFAllocatorRef  allocator,
  87.                                  const char *            buffer,
  88.                                  CFIndex                 bufLen,
  89.                                  Boolean                 isDirectory);
  90.  
  91. /* Attempts to read the data and properties for the given URL. */
  92. /* If only interested in one of the resourceData and properties, pass */
  93. /* NULL for the other.  If properties is non-NULL and desiredProperties */
  94. /* is NULL, then all properties are fetched.  Returns success or failure; */
  95. /* note that as much work as possible is done even if FALSE is returned. */
  96. /* So for instance if one property is not available, the others are fetched */
  97. /* anyway. errorCode is set to 0 on success, and some other value on failure. */
  98. /* If non-NULL, it is the caller 's responsibility to release resourceData */
  99. /* and properties. */
  100. /* Apple reserves for its use all negative error code values; these values */
  101. /* represent errors common to any scheme.  Scheme-specific error codes */
  102. /* should be positive, non-zero, and should be used only if one of the */
  103. /* predefined Apple error codes does not apply.  Error codes should be */
  104. /* publicized and documented with the scheme-specific properties. */
  105. EXTERN_API_C( Boolean )
  106. CFURLCreateDataAndPropertiesFromResource (CFAllocatorRef  alloc,
  107.                                  CFURLRef                 url,
  108.                                  CFDataRef *            resourceData,
  109.                                  CFDictionaryRef *        properties,
  110.                                  CFArrayRef             desiredProperties,
  111.                                  SInt32 *                errorCode);
  112.  
  113. /* Attempts to write the given data and properties to the given URL. */
  114. /* If dataToWrite is NULL, only properties are written out (use */
  115. /* CFURLDestroyResource() to delete a resource).  Properties not present */
  116. /* in propertiesToWrite are left unchanged, hence if propertiesToWrite */
  117. /* is NULL or empty, the URL's properties are not changed at all. */
  118. /* Returns success or failure; errorCode is set as for */
  119. /* CFURLCreateDataAndPropertiesFromResource(), above. */
  120. EXTERN_API_C( Boolean )
  121. CFURLWriteDataAndPropertiesToResource (CFURLRef         url,
  122.                                  CFDataRef                 dataToWrite,
  123.                                  CFDictionaryRef         propertiesToWrite,
  124.                                  SInt32 *                errorCode);
  125.  
  126. /* Destroys the resource indicated by url. */
  127. /* Returns success or failure; errorCode set as above. */
  128. EXTERN_API_C( Boolean )
  129. CFURLDestroyResource            (CFURLRef                 url,
  130.                                  SInt32 *                errorCode);
  131.  
  132. /* Convenience method which calls through to CFURLCreateDataAndPropertiesFromResource(). */
  133. /* Returns NULL on error and sets errorCode accordingly. */
  134. EXTERN_API_C( CFTypeRef )
  135. CFURLCreatePropertyFromResource    (CFAllocatorRef         alloc,
  136.                                  CFURLRef                 url,
  137.                                  CFStringRef             property,
  138.                                  SInt32 *                errorCode);
  139.  
  140. /* Common error codes; this list is expected to grow */
  141. enum {
  142.     kCFURLUnknownError            = -10,
  143.     kCFURLUnknownSchemeError    = -11,
  144.     kCFURLResourceNotFoundError    = -12,
  145.     kCFURLResourceAccessViolationError = -13,
  146.     kCFURLRemoteHostUnavailableError = -14,
  147.     kCFURLImproperArgumentsError = -15,
  148.     kCFURLUnknownPropertyKeyError = -16,
  149.     kCFURLPropertyKeyUnavailableError = -17,
  150.     kCFURLTimeoutError            = -18
  151. };
  152.  
  153. /* Properties and error codes for the file: scheme.  These are ad hoc and expected to change */
  154. extern const CFStringRef kCFFileURLExists;
  155. extern const CFStringRef kCFFileURLPOSIXMode;
  156. extern const CFStringRef kCFFileURLDirectoryContents;
  157. extern const CFStringRef kCFFileURLSize;
  158. extern const CFStringRef kCFFileURLLastModificationTime;
  159. extern const CFStringRef kCFHTTPURLStatusCode;
  160. extern const CFStringRef kCFHTTPURLStatusLine;
  161. /* kCFFileURLExists is set to kCFFileURLExists if the file exists; any other value if not */
  162. /* kCFFileURLPOSIXMode encompasses permissions and file type; use the POSIX masks in stat.h */
  163. /* to get specifics.  Value is a CFData wrapped around a mode_t */
  164. /* kCFFileURLDirectoryContents value is a CFArray with containing URLs for the directory's contents. */
  165. /* Empty array means the directory exists, but is empty. */
  166. /* NULL value (but no failure) means the URL exists but is not a directory. */
  167. /* Not settable */
  168. /* kCFHTTPURLStatusCode and kCFHTTPURLStatusLine are properties for the http: scheme. */
  169. /* Except for the common error */
  170. /* codes, above, errorCode will be set to the HTTP response status */
  171. /* code upon failure.  The status code is a CFNumber, the status line is a CFString.  */
  172.  
  173. #if PRAGMA_ENUM_ALWAYSINT
  174.     #pragma enumsalwaysint reset
  175. #elif PRAGMA_ENUM_OPTIONS
  176.     #pragma option enum=reset
  177. #elif defined(PRAGMA_ENUM_PACK__COREFOUNDATION_CFURLACCESS__)
  178.     #pragma options(pack_enums)
  179. #endif
  180.  
  181. #if PRAGMA_STRUCT_ALIGN
  182.     #pragma options align=reset
  183. #elif PRAGMA_STRUCT_PACKPUSH
  184.     #pragma pack(pop)
  185. #elif PRAGMA_STRUCT_PACK
  186.     #pragma pack()
  187. #endif
  188.  
  189. #ifdef PRAGMA_IMPORT_OFF
  190. #pragma import off
  191. #elif PRAGMA_IMPORT
  192. #pragma import reset
  193. #endif
  194.  
  195. #ifdef __cplusplus
  196. }
  197. #endif
  198.  
  199. #endif /* __COREFOUNDATION_CFURLACCESS__ */
  200.  
  201.